package com.bloody.android.Map;

import java.io.Serializable;
import java.util.ArrayList;

import com.bloody.android.BloodyCrusadeGame;
import com.bloody.android.ViewObject;
import com.bloody.android.Characters.Character;

import android.content.Context;
import android.util.Log;

public abstract class Case implements Serializable{

	private int posx;
	private int posy;
	private Character character;
	private int landscape;
	private boolean check;
	
	public Case(int posx, int posy, int landscape){
		this.posx=posx;
		this.posy=posy;
		this.landscape = landscape;
		this.character=null;
		this.check = false;
	}
	
	
	
	public int getPosx() {
		return posx;
	}

	public int getPosy() {
		return posy;
	}

	public void display(BloodyCrusadeGame bc){
		if (isItSomeone()){
			if (character.getPlayer()==bc.getPlayer()){
				if (character.getHasPlayed()==false){
					check = true;
					bc.charDisplay(character);
				}
			}
		}
	}
	
	public void hidden(){
		check = false;
	}
	
	public boolean isCheck() {
		return check;
	}

	public void setCheck(boolean check) {
		this.check = check;
	}

	public boolean isItSomeone(){
		if (character==null){
			return false;
		}
		return true;
	}
	
	public boolean addCharacter(Character character){
		if (!isItSomeone()){
			this.character = character;
			this.characterBonus(1, character);
			return true;
		}
		return false;
	}
	
	public Character getCharacter() {
		return character;
	}

	/*public void setCharacter(Character character) {
		this.character = character;
	}*/

	public int getLandscape() {
		return landscape;
	}
	
	public abstract void setViewCase(Context context, ArrayList<ViewObject> vElement);

	public boolean removeCharacter(){
		if (isItSomeone()){
			this.characterBonus(-1, character);
			this.character = null;
			Log.d("DEBUG", "map clean");
			return true;
		}
		return false;
	}
	
	public abstract void characterBonus(int choice, Character ch);
}
